<%@ page import="java.sql.*,java.util.*,java.text.*,java.text.SimpleDateFormat" %>
<%@ page import="javax.servlet.*" %>
<%@page import="connection.DBConnection"%>

<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/css" charset=ISO-8859-1">
<title>Books Of Account</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">

<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        
        <LINK REL=StyleSheet HREF="dimming.css" TYPE="text/css">
		<SCRIPT LANGUAGE="JavaScript" SRC="dimmingdiv1.js">
		</SCRIPT>

<style>
div.dimmer 
{
	visibility: hidden;
	position:absolute;
	left:0px;
	top:0px;
	font-family:verdana;
	font-weight:bold;
	padding:40px;

	background-image:url(honey.png);
	/* ieWin only stuff */
	_background-image:none;
	_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='honey.png');
}


div.dimming {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-style: normal;
	background-color: #ffffff;
	position:absolute;
	/* set z-index higher than possible */
	z-index:10000;
	visibility: hidden;
	
	border-style: solid;
	border-color: #999999;
	border-width: 1px;

}

table.floatingHeader
{
	background-color: #0000ff;
	color:#ffffff;
}


</style>
		<script language="javascript">
		    function displayWindow()
		    {
		        var w, h, l, t;
		        w = 400;
		        h = 200;
		        l = screen.width/4;
		        t = screen.height/4;
                
                // no title		        
		        // displayFloatingDiv('windowcontent', '', w, h, l, t);

                // with title		        
		        displayFloatingDiv('windowcontent', 'Overdue Receivables', w, h, l, t);
		    }
		    
		    
		</script>
<script language="javascript">

function display()
{
    var w, h, l, t;
    w = 400;
    h = 200;
    l = screen.width/4;
    t = screen.height/4;
    
    // no title		        
    // displayFloatingDiv('windowcontent', '', w, h, l, t);

    // with title		        
    displayFloatingDiv('content1', 'Overdue Payables', w, h, l, t);
}
function displaywindow2()
{
    var w, h, l, t;
    w = 400;
    h = 200;
    l = screen.width/4;
    t = screen.height/4;
    
    // no title		        
    // displayFloatingDiv('windowcontent', '', w, h, l, t);

    // with title		        
    displayFloatingDiv('windowcontent2', 'Due Date of Invoices to be paid', w, h, l, t);
}
function displaywindow3()
{
    var w, h, l, t;
    w = 400;
    h = 200;
    l = screen.width/4;
    t = screen.height/4;
    
    // no title		        
    // displayFloatingDiv('windowcontent', '', w, h, l, t);

    // with title		        
    displayFloatingDiv('windowcontent3', 'Due Date of Invoices to be received', w, h, l, t);
}
</script>


 <style type="text/css">

label, input { display:block; }
input.text { margin-bottom:12px; width:95%; padding: .4em; }
fieldset { padding:0; border:0; margin-top:25px; }
h1 { font-size: 1.2em; margin: .6em 0; }
div#users-contain { width: 350px; margin: 20px 0; }
div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
.ui-dialog .ui-state-error { padding: .3em; }
.validateTips { border: 1px solid transparent; padding: 0.3em; }



</style>

<style>
div ul ul {
	display: none;
}

	div ul li:hover > ul {
		display: block;
	}
	
	div ul {
	background: #efefef; 
	background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);  
	background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
	background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%); 
	box-shadow: 0px 0px 9px rgba(0,0,0,0.10);
	padding: 0px ;
	margin: opx
	border-radius: 10px;  
	list-style: none;
	position: relative;
	display: inline-table;
	
}
	div ul:after {
		content: ""; clear: both; display: block;
	}
	
	div ul li {
	float: left;
}
	div ul li:hover {
		background: #4b545f;
		background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
		background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
		background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
	}
		div ul li:hover a {
			color: yellow;
		}
	
	div ul li a {
		display: block; padding: 15px 40px;
		color: blue; text-decoration: none;
	}
	div ul ul {
	background: #5f6975; border-radius: 0px; padding: 0;
	position: absolute; top: 100%;
}
	div ul ul li {
		float: none; 
		border-top: 1px solid #6b727c;
		border-bottom: 1px solid #575f6a;
		position: relative;
	}
		div ul ul li a {
			padding: 5px 40px;
			color: #fff;
		}	
			div ul ul li a:hover {
				background: #4b545f;
			}
div ul ul ul {
	position: absolute; left: 100%; top:0;
}
</style>

<style type="text/css">

.box
{
background-color:#3d4543;
height:350px;
width:300px;
border-radius:10px;
position:left;
top:0px;
left:40%;
} 
 
 
 
 .display
{
postion:relative;
width:220px;
position:relative;
left:15px;
top:20px;
height:40px;
}
.display input
{
position:relative;
left:2px;
top:2px;
height:35px;
color:black;
background-color:#bccd95;
font-size:21px;
text-align:right;
} 
 
 
 .keys
{
position:relative;
top:20px;
}
.button
{
width:40px;
height:30px;
border:none;
border-radius:8px;
margin-left:17px;
cursor:pointer;
border-top:2px solid transparent;
}
.button.gray
{
color:white;
display: inline;
background-color:#6f6f6f;
border-bottom:black 1px solid;
border-top:1px #6f6f6f solid;
}
.button.pink
{
color:black;

background-color:#ff4561;
border-bottom:black 2px solid;
}
.button.black
{
color:blue;
display: inline;
background-color:303030;
border-bottom:black 2px solid;
border-top:2px 303030 solid;
}
.button.orange
{
color:black;
background-color:FF9933;
border-bottom:black 2px solid;
border-top:2px FF9933 solid;
}
.gray:active
{
border-top:black 2px solid;
border-bottom:2px #6f6f6f solid;
}
.pink:active
{
border-top:black 2px solid;
border-bottom:#ff4561 2px solid;
}
.black:active
{
border-top:black 2px solid;
border-bottom:#303030 2px solid;
}
.orange:active
{
border-top:black 2px solid;
border-bottom:FF9933 2px solid;
}
p
{
line-height:10px;
}

</style>

<script >
$(function() {
	var dialog, form,
	// From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
	emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
	name = $( "#name" ),
	email = $( "#email" ),
	password = $( "#password" ),
	allFields = $( [] ).add( name ).add( email ).add( password ),
	tips = $( ".validateTips" );
	function updateTips( t ) {
	tips
	.text( t )
	.addClass( "ui-state-highlight" );
	setTimeout(function() {
	tips.removeClass( "ui-state-highlight", 1500 );
	}, 500 );
	}
	function checkLength( o, n, min, max ) {
	if ( o.val().length > max || o.val().length < min ) {
	o.addClass( "ui-state-error" );
	updateTips( "Length of " + n + " must be between " +
	min + " and " + max + "." );
	return false;
	} else {
	return true;
	}
	}
	function checkRegexp( o, regexp, n ) {
	if ( !( regexp.test( o.val() ) ) ) {
	o.addClass( "ui-state-error" );
	updateTips( n );
	return false;
	} else {
	return true;
	}
	}
	function checkValue(){
		var msg = "";
		if (f1.operand1.value == "" || f1.operand2.value == "")
		msg += "Operands missing\n";
		if (f1.op.selectedIndex == 3 && f1.operand2.value == 0)
		msg += "Division by zero";
		if (msg.length > 0){
		alert(msg);
		
		
		return false;
		} else
		return true;
		}	
	
	dialog = $( "#dialog-form" ).dialog({
	autoOpen: false,
	height: 500,
	width: 350,
	modal: true,
   
	
	minimize: function()
	{
		form[0].minimize();	},
	buttons: {
	
		
	close: function() {
	dialog.dialog( "close" );
	}
	
	},
	close: function() {
	form[ 0 ].reset();
	allFields.removeClass( "ui-state-error" );
	}
	
	
	
	});
	form = dialog.find( "form" ).on( "submit", function( event ) {
	event.preventDefault();
	addUser();
	});
	$( "#create-user" ).button().on( "click", function() {
	dialog.dialog( "open" );
	
	
   															
  
	});
	});
</script>
<script>
function c(val)
{
document.getElementById("d").value=val;
}
function v(val)
{
document.getElementById("d").value+=val;
}
function e() 
{ 
try 
{ 
  c(eval(document.getElementById("d").value)) 
} 
catch(e) 
{
  c('Error') 
} 
}  


</script>


</head>
<body>
<form>

<%
String un = (String) request.getAttribute("us");
String pw = (String) request.getAttribute("ps");

%>
 <div>
	<ul>
		<li ><a href="#">Create New</a>
		<ul>
		        <li><a href="CustomerMaster.jsp" name="cust" value="Customer">Customer</a></li>
                <li><a href="SupplierMaster.jsp">Supplier</a></li>
                <li><a href="GeneralLedger.jsp">General ledger</a></li>
                <li><a href="BankMaster.jsp">Bank/Cash</a></li>
                <li><a href="StockMaster.jsp">Stock Item</a></li>
			</ul>
		</li>
		
		<li><a href="#">Data Entry</a>
		<ul>
				 <li><a href="SalesVoucher.jsp">Sales</a></li>
                <li><a href="PurchaseVoucher.jsp">Purchase</a></li>
                <li><a href="JournalVoucher.jsp">Journal Voucher</a></li>   
                <li><a href="DebitNote.jsp">Debit Note</a></li> 
                <li><a href="CreditNote.jsp">Credit Note</a></li> 
                <li><a href="ReceiptsVoucher.jsp">Receipts</a></li> 
                <li><a href="PaymentVoucher.jsp">Payments</a></li> 
                <li><a href="ContraVoucher.jsp">Contra</a></li>  
			</ul>
		</li>
		<li><a href="#">Financial Reports</a>
		<ul>
				<li><a href="LedgerReport.jsp">A Ledger Report</a></li>
				<li><a href="TrialBalance.jsp">Trial Balance</a></li>
				
				<li><a href="ProfitAndLossAccount2.jsp">Profit And Loss Account</a></li>
				<li><a href="Balancesheet2.jsp">Balance Sheet</a></li>
				<li><a href="#">Cash Flow ></a>
				<ul>
				<li><a href="#">Bank Account Status</a></li>
				<li><a href="#">Uncleared Checks</a></li>
				<li><a href="#">Bills Due for Payment</a></li>
				
				</ul>
				
				</li>
				<li><a href="#">Register   ></a>
				<ul>
				<li><a href="SalesVoucherReport.jsp">Sales Register</a></li>
				<li><a href="PurchaseVoucherReport.jsp">Purchase Register</a></li>
				<li><a href="JournalVoucherReport.jsp">Journal Register</a></li>
				<li><a href="DebitNote.jsp"> Debit Note Register</a></li>
				<li><a href="CreditNote.jsp">Credit Note Register</a></li>
				<li><a href="#">Bank Book</a></li>
				<li><a href="#">Cash Book</a></li>
			</ul>
				</li>
				
			</ul>
		</li>
		<li><a href="#">Management Reports</a>
		<ul>
		<li><a href="OpeningBalanceReport.jsp">Opening Balance Report </a></li>
		<li><a href="#">Master Information ></a>
		
		<ul><li><a href="CustomerMasterReport.jsp">Customer Master</a></li>
				<li><a href="SupplierMasterReport.jsp">Supplier Master</a></li>
				</ul>
		</li>
		<li><a href="#">Invoice Wise Details ></a>
				<ul>
				<li><a href="CustomerWise.jsp">Customerwise Invoice Details</a></li>
				<li><a href="SupplierWise.jsp">Supplierwise Invoice Details</a></li>
				</ul></li>
	
		</ul>
		</li>
		<li><a href="#">Log Details</a>
		<ul>
		<li><a href="#">Log ></a>
		<ul>
		<li><a href="MasterLog.jsp">Master Log Details</a></li>
		<li><a href="TransactionLog.jsp">Transaction Log Details</a></li>
		</ul>
		</li>
		<li><a href="#">Clear All</a></li>
		</ul>
		</li>
		<li><a href="#">Settings</a>
		<ul>
				<li><a href="EditRegister2.jsp">Change Master Information</a></li>
				<li><a href="ChangePassword.jsp">Change Password</a></li>
				<li><a href="QuickFunction.jsp">Customise Quick Function</a></li>
				</ul>
		</li>
		<li><a href="logout1.jsp">Log Out</a></li>
	</ul>
</div>  
</form>
 
  <%
DBConnection dbc2=new DBConnection();
Connection con5=dbc2.getNewConnection();
Statement st5 = null;
ResultSet rs5 = null;
String a1="",a3="",a4="",a5="",a6="",a8="",a9="",a2="",a7="";
int l=0,j=0;
try{
 st5 = con5.createStatement();
String queryString2 = "SELECT  org_name,mvat,address,city,dist,state,pin,autho_person,designation from register where panno='"+un+"' ";
rs5 = st5.executeQuery(queryString2);
while(rs5.next()){ 
		
	  a1=rs5.getString(1); //bankname	        
   a2=rs5.getString(2);
    a3=rs5.getString(3);
	 a4=rs5.getString(4); //amount11
  a5=rs5.getString(5);
  a6=rs5.getString(6);
 a7=rs5.getString(7);
  a8=rs5.getString(8);
 a9=rs5.getString(9);
}
con5.close();

}
catch(Exception e)
{
	
}




%>

<%
	DBConnection dbc=new DBConnection();
Connection con=dbc.getNewConnection();
Statement st6 = null;
ResultSet rs6 = null;
String name1="";
int count1=0;
double tot=0.0,am=0.0,am1=0.0,am2=0.0,am3=0.0,ctot=0.0,stot=0.0,ltot=0.0,btot=0.0;
	System.out.println("MySQL Connect Example.");
	

	  

try
{
	  st6=con.createStatement() ;
	  rs6=st6.executeQuery("select cname,copen from customermaster");
while(rs6.next()){
	name1=rs6.getString(1);
	
	 am=rs6.getDouble(2);
	 ctot=ctot+am;
	 count1++;
	}} 
catch(Exception e) {}


try
{
	  st6=con.createStatement() ;
	  rs6=st6.executeQuery("select sname,sopen from suppliermaster");
while(rs6.next()){
	name1=rs6.getString(1);
	
	 am1=rs6.getDouble(2);
	 stot=stot+am1;
	 count1++;
	}} 
catch(Exception e) {} 
try
{
	  st6=con.createStatement() ;
	  rs6=st6.executeQuery("select gname,ggroup,gopen from generalledger2;");
	  while(rs6.next()){
			name1=rs6.getString(1);
			String name2=rs6.getString(2);
			 am2=rs6.getDouble(3);
			 ltot=ltot+am2;
			 count1++;
			
}} 
catch(Exception e) {} 

try
{
	  st6=con.createStatement() ;
	  rs6=st6.executeQuery("select bname,bopen from bankmaster ;");
	  while(rs6.next()){
			name1=rs6.getString(1);
			
			 am3=rs6.getDouble(2);
			 btot=btot+am3;
			 count1++;
			}} 
catch(Exception e) {} 
 tot=ctot+stot+ltot+btot; 


%>
 <%if(a1=="" ||a2=="" ||a3=="" || a4=="" || a5=="" || a6=="" || a7==""  || a8=="" || a9=="")
 {
	j=1	;
	 
	 }
 if(tot!=0.0)
 { l=1;
 
 }
 if(j==1 || l==0)
 {
	 out.println("<marquee><font color=red><u><a href=http://localhost:8081/BOA_Web/EditRegisterServlet?pan="+un+">*Master details not completed</a></u></font></marquee>");	

 }
 if(j==1 && l==1)
 {
	 out.println("<marquee><font color=red><u><a href=OpeningBalanceReport.jsp>*Opening Balance didn't tally</a></u></<font></marquee>");	

 }

 %>
 <form action=SearchServlet>
<table >
 <tr><td> Search</td> <td><input type=text name=search width=100%/></td><td><font color=blue> <input type=submit  Value=Search /></font></td></tr>

  </table>
  </form>
  <br><br>
  
  
  
  <%
  
  Connection conn2 = null;
  String url2 = "jdbc:mysql://localhost:3306/";
  String dbName2 = "boa";
  String driver2 = "com.mysql.jdbc.Driver";
  String username2 = "root"; 
  String userPassword2= "root";

double b4=0.0;
 
  try 
  {
    Class.forName(driver2).newInstance();
    conn2 = DriverManager.getConnection(url2+dbName2,username2,userPassword2);
    Statement st = conn2.createStatement();
    Statement st1 = conn2.createStatement();
    String queryString1 = "SELECT  bankname, Date, sum(amount11) FROM ( (SELECT bname AS bankname, date as Date, ramount AS amount11 FROM ReceiptsVoucher2 where bname <> 'Cash') UNION ALL (SELECT bname AS bankname, date as Date, -(pyamount) AS amount11 FROM PaymentVoucher2 where bname <> 'Cash') ) p ";
    ResultSet rs = st.executeQuery(queryString1);
    while(rs.next()){ 
    		
    	 String b1=rs.getString(1); //bankname	        
       String  b5=rs.getString(2);
    	double b2=rs.getDouble(3); //amount11
    // double b3=rs.getDouble(4);
    		b4=b2; // +b3;
    }
    
    conn2.close();
       		  } 
            catch(Exception e) {} %>     
            
            
            <div id=dialog-form title="Calculator">
<p class="validateTips"></p>
<div class="box" id=box>

<div class="display"><input type="text"  size="18" id="d"></div>
<div class="keys">
    <p><input type="button" class="button gray" id="button gray" value="mrc" onclick='c("Created....................")'>
    <input type="button" class="button gray" id="button gray" value="m-" onclick='c("...............by............")'>
    <input type="button" class="button gray" id="button gray" value="m+" onclick='c(".....................Amit")'>
    <input type="button" class="button black" value="/" onclick='v("/")'></p>
    <p><input type="button" class="button black" value="7" onclick='v("7")'>
    <input type="button" class="button black" value="8" onclick='v("8")'>
    <input type="button" class="button black" value="9" onclick='v("9")'>
    <input type="button" class="button black" value="*" onclick='v("*")'></p>
    <p><input type="button" class="button black" value="4" onclick='v("4")'>
    <input type="button" class="button black" value="5" onclick='v("5")'>
    <input type="button" class="button black" value="6" onclick='v("6")'>
    <input type="button" class="button black" value="-" onclick='v("-")'></p>
    <p><input type="button" class="button black" value="1" onclick='v("1")'>
    <input type="button" class="button black" value="2" onclick='v("2")'>
    <input type="button" class="button black" value="3" onclick='v("3")'>
    <input type="button" class="button black" value="+" onclick='v("+")'></p>
    <p><input type="button" class="button black" value="0" onclick='v("0")'>
    <input type="button" class="button black" value="." onclick='v(".")'>
    <input type="button" class="button black" value="C" onclick='c("")'>
    <input type="button" class="button black" value="=" onclick='e()'></p>

</div>
</div></div>
<br>
<br>
            
            
   <input type=button id=create-user value="Calculator">
  
  <table align="right">
  <tr><th><u>Cash Position</u></th></tr>
  <tr><td>Cash in Hand:</td><td></td></tr>
  <tr><td>Cash at Bank:</td><td><%=b4 %></td></tr>
  </table>
  <br>
  
  
 
  <table align="center">
  <tr><th><font color=red>Quick Function</font></th></tr>
  <%
  DBConnection dbc7=new DBConnection();
	Connection con7=dbc7.getNewConnection();
	
	Statement st7 = null;
	ResultSet rs7 = null;

try
	{
	   st7=con7.createStatement() ;
		   rs7=st7.executeQuery("select voucher from vouchers; ");
 while(rs7.next()){ 
    String vch=rs7.getString(1);
    %>
    
    <tr><td><a href="http://localhost:8081/BOA_Web/QuickFunctionServlet?vouchertype=<%=vch %>"><%=vch %></a></td></tr>
      
      
     <%    }
con7.close();
}
  catch(Exception e)
  {
	  
  }

%>

<%
  DBConnection dbc8=new DBConnection();
	Connection con8=dbc8.getNewConnection();
	
	Statement st8 = null;
	ResultSet rs8 = null;

try
	{
	   st8=con8.createStatement() ;
		   rs8=st8.executeQuery("select gcode,general from generalquick; ");
 while(rs8.next()){ 
    String vch1=rs8.getString(1);
    String vch2=rs8.getString(2);
    %>
    
    <tr><td><a href="http://localhost:8081/BOA_Web/QuickFunctionServlet2?vouchertype=<%=vch1 %>"><%=vch2 %></a></td></tr>
      
      
     <%    }
 con8.close();
}
  catch(Exception e)
  {
	  
  }

%>

<%
  DBConnection dbc9=new DBConnection();
	Connection con9=dbc9.getNewConnection();
	
	Statement st9 = null;
	ResultSet rs9 = null;

try
	{
	   st9=con9.createStatement() ;
		   rs9=st9.executeQuery("select mcode,master from masterquick; ");
 while(rs9.next()){ 
    String vch2=rs9.getString(1);
    String vch3=rs9.getString(2);
    %>
    
    <tr><td><a href="http://localhost:8081/BOA_Web/QuickFunctionServlet3?vouchertype=<%=vch2 %>"><%=vch3 %></a></td></tr>
      
      
     <%    }
 con9.close();
}
  catch(Exception e)
  {
	  
  }

%>
  </table>
  <br><br><br><br>
  
  
  
  
  <table width=100%>
  <tr>
  <td>
  <table width=50%><tr> <td><a href="javascript:displayWindow();">Overdue Receiveables</a></td><td>&nbsp</td><td>&nbsp</td>&nbsp&nbsp&nbsp&nbsp&nbsp<td>&nbsp&nbsp<a href="javascript:displaywindow2();">Due Date of Invoices to be paid</a></td></tr>
 <tr><td> <a href="javascript:display();">Overdue Payables</a></td><td>&nbsp</td><td>&nbsp</td>&nbsp&nbsp&nbsp&nbsp&nbsp<td>&nbsp&nbsp<a href="javascript:displaywindow3();">Due Date of Invoices to be received</a></td></tr>
  </table></td>
  <td>
  <table width=50%>
  <tr><th>Stock Position</th></tr></table>
 </td></tr></table>
 
 
 
 <div style="width: 518px; height: 287px;visibility:hidden" id="windowcontent">
            <script language="javascript">
            function Hello()
            {
               alert('Hello '+  document.getElementById('yourname').value + '!');
               
               
            }
            </script>
            
            <table border=2>
            <tr>
		<td>Date </td>
		<td>Due date</td>
    	<td>Reference number</td>
    	<td>Amount </td>
    	</tr>
            <%
            DBConnection dbc1=new DBConnection();
			Connection con3=dbc1.getNewConnection();
			
			Statement st3 = null;
			ResultSet rs3 = null;
             SimpleDateFormat sim = new SimpleDateFormat("dd-MM-yyyy");
             java.util.Date currentdte=new java.util.Date();
            Calendar calendar = Calendar.getInstance();
            SimpleDateFormat fromsql = new SimpleDateFormat("yyyy-MM-dd");
        // out.println(currentdte);
            String inv="",newdate="",cd="";
			 double adj=0.0,amt1=0.0,tot1=0.0;
			 int cred=0,cred2=0;
			 try
			 {
			    st3=con.createStatement() ;
			    

			        		   rs3=st3.executeQuery("select date,innum,ccode,adjamount,sum(balance),scred from salesinvoiceoutstanding group by innum");
			 	        	//rs=st.executeQuery("select date,");
			 	         while(rs3.next()){ 
			 	        	 String dt=rs3.getString(1);
			 	        	 inv=rs3.getString(2);
			 	        	 cd=rs3.getString(3);
			 	        	double amt=rs3.getDouble(4);
			 	        	double am4=rs3.getDouble(5);
			 	        	 cred=rs3.getInt(6);
			 	        	tot1=tot1+am;
			 	        
			 	         newdate =sim.format(fromsql.parse(dt));
			 	        
			 	        calendar.setTime(sim.parse(newdate));
			 	       calendar.add(Calendar.DATE,cred); 
			 	      java.util.Date due = calendar.getTime();
			 	        
	       if(currentdte.after(due))
	       {
	    	   String due2=sim.format(due);
	    	  %>
	    	<tr>
	         <td><%=newdate%></td>
	         <td><%=due2 %></td>
	         <td><%=inv%></td>
	          <td><%=am4 %></td>
	         </tr>
	    	  
	    	 
	    	  <% 
	       }
	  }
			 	         
			 	         
			 	        rs3=st3.executeQuery("select date, ccode,innum, sum(stota),scredlim from salesvoucher2 where ccode <> '"+cd+"' group by innum");
			 	       while(rs3.next())
			 	       { 
			 	       String dt=rs3.getString(1);
			 	      String cd1=rs3.getString(2);
			 	       String inn1=rs3.getString(3);

			 	       double tot2=rs3.getDouble(4);
			 	       cred2=rs3.getInt(5);
			 	       
			 	       String newdate1 =sim.format(fromsql.parse(dt));

			 	       calendar.setTime(sim.parse(newdate1));
			 	       calendar.add(Calendar.DATE,cred2); 
			 	      java.util.Date due1 = calendar.getTime();
			 	      // out.println(currentdte);
			 	      if(currentdte.after(due1))
				       {
			 	       String due2=sim.format(due1);
			 	       %>
			 	       <tr>
			 	       	         <td><%=newdate1%></td>
			 	       	         <td><%=due2 %></td>
			 	       	       <td><%=inn1 %></td>
			 	       	         <td><%=tot2%></td>
			 	       	         </tr>
	        <% }}con3.close();
			}
			catch(Exception e){}
            %>
            
            
            
           
            
            </table>
</div>
 
 
 
 
  
 
 
 <div style="width: 518px; height: 287px;visibility:hidden" id="content1">
            <script language="javascript">
            function Hello()
            {
               alert('Hello '+  document.getElementById('yourname').value + '!');
               
               
            }
            </script>
            
            <table border=2>
            <tr>
		<td>Date </td>
		<td>Due date</td>
    	<td>Reference number</td>
    	<td>Amount </td>
    	</tr>
           <%
            DBConnection dbc3=new DBConnection();
			Connection con4=dbc3.getNewConnection();
			
			Statement st4 = null;
			ResultSet rs4 = null;
             SimpleDateFormat sim1 = new SimpleDateFormat("dd-MM-yyyy");
             java.util.Date currentdte1=new java.util.Date();
            Calendar calendar1 = Calendar.getInstance();
            SimpleDateFormat fromsql1 = new SimpleDateFormat("yyyy-MM-dd");

            String inv1="",newdate1="",cd1="",cd2="";
			 double adj1=0.0,amt2=0.0;
			 int cred1=0;
            try
			{
			   st4=con4.createStatement() ;
			   rs4=st4.executeQuery("select date,pvinno,scode,adjamount,sum(balance),pvcred from purchaseinvoiceoutstanding group by pvinno");
	        	//rs=st.executeQuery("select date,");
	         while(rs4.next()){ 
	        	 String dt=rs4.getString(1);
	        	 inv1=rs4.getString(2);
	        	 cd2=rs4.getString(3);
	        	double amt=rs4.getDouble(4);
	        	double am4=rs4.getDouble(5);
	        	 cred=rs4.getInt(6);
	        	tot1=tot1+am;
	        amt1=amt1+amt;
	         newdate1 =sim.format(fromsql.parse(dt));
	     //   out.println(cd);
	        calendar1.setTime(sim.parse(newdate1));
	       calendar1.add(Calendar.DATE,cred); 
	    	       java.util.Date due3=calendar1.getTime();
	    	       
	    	       
	       if(currentdte.after(due3))
	       {
 	       String due4=sim.format(due3);
 	     // out.println(due4);
	         %>
	         <tr>
	         <td><%=newdate1%></td>
	         <td><%=due4 %></td>
	         <td><%=inv1%></td>
	         
	         <td><%=am4 %></td>
	         </tr>

       
	    	  <% 
	       }}
	         rs4=st4.executeQuery("select date, scode,pvinno, sum(pvtota),pvcredlim from purchasevoucher2 where scode <> '"+cd2+"' group by pvinno");
	         while(rs4.next())
	         { 
	         String dt=rs4.getString(1);
	         cd1=rs4.getString(2);
	         String inn1=rs4.getString(3);

	         double tot2=rs4.getDouble(4);
	         cred1=rs4.getInt(5);
	          tot1=tot1+tot;

	         String newdate2 =sim.format(fromsql.parse(dt));

	         calendar1.setTime(sim.parse(newdate2));
	         calendar1.add(Calendar.DATE,cred1); 
	         java.util.Date  due5 =calendar1.getTime();
	        
	         if(currentdte.after(due5))
		       {
	 	       String due6=sim.format(due5);
	 	       
	         %>
	         <tr>
	         	         <td><%=newdate2%></td>
	         	         <td><%=due6 %></td>
	         	       <td><%=inn1 %></td>
	         	         <td><%=tot2%></td>
	         	         </tr>
	      <% }}
	         con4.close();
			}
			catch(Exception e){}
            %>
            
   
            </table>
</div>
 
 
 
 
 
 <div style="width: 518px; height: 287px;visibility:hidden" id="windowcontent2">
            <script language="javascript">
            function Hello()
            {
               alert('Hello '+  document.getElementById('yourname').value + '!');
               
               
            }
            </script>
            
            <table border=2>
            <tr>
		<td>Date </td>
		<td>Due date</td>
    	<td>Reference number</td>
    	<td>Amount </td>
    	</tr>
           <%
            DBConnection dbc4=new DBConnection();
			Connection con6=dbc4.getNewConnection();
			
			Statement st10 = null;
			ResultSet rs10 = null;
             SimpleDateFormat sim2 = new SimpleDateFormat("dd-MM-yyyy");
             java.util.Date currentdte2=new java.util.Date();
            Calendar calendar2 = Calendar.getInstance();
            SimpleDateFormat fromsql2 = new SimpleDateFormat("yyyy-MM-dd");

            String inv2="",newdate2="",cd3="",cd4="",cd8="";
			 double adj2=0.0,amt3=0.0;
			 int cred3=0;
            try
			{
			   st10=con6.createStatement() ;
			   rs10=st10.executeQuery("select date,pvinno,scode,adjamount,balance,pvcred from purchaseinvoiceoutstanding where balance <> 0 group by pvinno");
	        	//rs=st.executeQuery("select date,");
	         while(rs10.next()){ 
	        	 String dt=rs10.getString(1);
	        	 inv2=rs10.getString(2);
	        	 cd3=rs10.getString(3);
	        	double amt=rs10.getDouble(4);
	        	double am4=rs10.getDouble(5);
	        	 cred3=rs10.getInt(6);
	        	tot1=tot1+am;
	        amt1=amt1+amt;
	         newdate2 =sim2.format(fromsql2.parse(dt));
	     // out.println(inv2);
	        calendar2.setTime(sim2.parse(newdate2));
	       calendar2.add(Calendar.DATE,cred3); 
	    	       String due7=sim2.format(calendar2.getTime());
	    	       
	    	       
	       
 	     // out.println(due4);
	         %>
	         <tr>
	         <td><%=newdate1%></td>
	         <td><%=due7 %></td>
	         <td><%=inv2%></td>
	         
	         <td><%=am4 %></td>
	         </tr>

       
	    	  <% } rs10=st10.executeQuery("select scode from purchaseinvoiceoutstanding");
	 	       while(rs10.next()){ 
	 	    	   cd8=rs10.getString(1);
	 	    	//  out.println(cd6);
	 	    	   
	 	       }
	 	       //out.println(cd8);
	       
	         rs10=st10.executeQuery("select date, scode,pvinno, sum(pvtota),pvcredlim from purchasevoucher2 where scode <> '"+cd8+"' group by pvinno");
	         while(rs10.next())
	         { 
	         String dt=rs10.getString(1);
	         cd4=rs10.getString(2);
	         String inn1=rs10.getString(3);

	         double tot2=rs10.getDouble(4);
	         cred3=rs10.getInt(5);
	          tot1=tot1+tot;

	         String newdate3 =sim2.format(fromsql2.parse(dt));

	         calendar2.setTime(sim2.parse(newdate3));
	         calendar2.add(Calendar.DATE,cred3); 
	         String  due9 =sim2.format(calendar2.getTime());
	        
	         
	 	       
	         %>
	         <tr>
	         	         <td><%=newdate3%></td>
	         	         <td><%=due9 %></td>
	         	       <td><%=inn1 %></td>
	         	         <td><%=tot2%></td>
	         	         </tr>
	      <% }
	         con6.close();
			}
			catch(Exception e){}
            %>
            
   
            </table>
</div>
 
 
 
 
 <div style="width: 518px; height: 287px;visibility:hidden" id="windowcontent3">
            <script language="javascript">
            function Hello()
            {
               alert('Hello '+  document.getElementById('yourname').value + '!');
               
               
            }
            </script>
            
            <table border=2>
            <tr>
		<td>Date </td>
		<td>Due date</td>
    	<td>Reference number</td>
    	<td>Amount </td>
    	</tr>
            <%
            DBConnection dbc5=new DBConnection();
			Connection con10=dbc5.getNewConnection();
			
			Statement st11 = null;
			ResultSet rs11 = null;
             SimpleDateFormat sim3 = new SimpleDateFormat("dd-MM-yyyy");
             java.util.Date currentdte3=new java.util.Date();
            Calendar calendar3 = Calendar.getInstance();
            SimpleDateFormat fromsql3 = new SimpleDateFormat("yyyy-MM-dd");
        // out.println(currentdte);
            String inv3="",newdate3="",cd5="",cd6="";
			 double adj4=0.0,amt4=0.0,tot3=0.0;
			 int cred4=0,cred5=0;
			 try
			 {
			    st11=con10.createStatement() ;
			    

			        		   rs11=st11.executeQuery("select date,innum,ccode,adjamount,sum(balance),scred from salesinvoiceoutstanding where balance <> 0 group by innum");
			 	        	//rs=st.executeQuery("select date,");
			 	         while(rs11.next()){ 
			 	        	 String dt=rs11.getString(1);
			 	        	 inv3=rs11.getString(2);
			 	        	 cd5=rs11.getString(3);
			 	        	 amt4=rs11.getDouble(4);
			 	        	double am4=rs11.getDouble(5);
			 	        	 cred4=rs11.getInt(6);
			 	        	tot1=tot1+am;
			 	       // out.println(cd5);
			 	         newdate3 =sim3.format(fromsql.parse(dt));
			 	        
			 	        calendar3.setTime(sim3.parse(newdate3));
			 	       calendar3.add(Calendar.DATE,cred4); 
			 	      String due8 = sim3.format(calendar3.getTime());
			 	        
	      
	    	  %>
	    	<tr>
	         <td><%=newdate3%></td>
	         <td><%=due8 %></td>
	         <td><%=inv3%></td>
	          <td><%=am4 %></td>
	         </tr>
	    	  
	    	 
	    	  <% 
	       }
	  
			 	        rs11=st11.executeQuery("select ccode from salesinvoiceoutstanding");
			 	       while(rs11.next()){ 
			 	    	   cd6=rs11.getString(1);
			 	    	//  out.println(cd6);
			 	    	   
			 	       }
			 	         
			 	        rs11=st11.executeQuery("select date, ccode,innum, sum(stota),scredlim from salesvoucher2 where ccode <> '"+cd6+"'  group by innum");
			 	       while(rs11.next())
			 	       { 
			 	       String dt=rs11.getString(1);
			 	      String cd7=rs11.getString(2);
			 	       String inn1=rs11.getString(3);

			 	       double tot2=rs11.getDouble(4);
			 	       cred4=rs11.getInt(5);
			 	       
			 	       String newdate4 =sim3.format(fromsql3.parse(dt));

			 	       calendar3.setTime(sim3.parse(newdate4));
			 	       calendar3.add(Calendar.DATE,cred4); 
			 	      String due1 = sim3.format(calendar3.getTime());
			 	      // out.println(currentdte);
			 	      
			 	       %>
			 	       <tr>
			 	       	         <td><%=newdate4%></td>
			 	       	         <td><%=due1 %></td>
			 	       	       <td><%=inn1 %></td>
			 	       	         <td><%=tot2%></td>
			 	       	         </tr>
	        <% }con3.close();
			}
			catch(Exception e){}
            %>
            
            
            
           
            
            </table>
</div>
 
<%
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "boa";
String driver = "com.mysql.jdbc.Driver";
String username = "root"; 
String userPassword = "root";


String user = "";
try 
{
  Class.forName(driver).newInstance();
  conn = DriverManager.getConnection(url+dbName,username,userPassword);
  Statement st = conn.createStatement();
  Statement st1 = conn.createStatement();
  String queryString = "select * from admin order by pan";
  ResultSet rs = st.executeQuery(queryString);
  ResultSet rs1=null;
  String queryStringuser="";
  SimpleDateFormat sdfDestination=null;
  int count=0;
  String strcolor = "";
  while(rs.next())
  {
  count = count%2;
  if(count==0)
  {
  strcolor = "#D9D9D9";
  }
  else
 {
  strcolor = "#EFEFEF";
  }
  count++;
  
 String inStr="";
  String outStr="";
  java.util.Date date;
  String intime="";
  String outtime="";
  if((rs.getString(2)!=null && rs.getString(2)!=""))
  {
  inStr = rs.getString(2).toString().substring(0,rs.getString(2).toString().indexOf("."));
  try
 {
 date = new  SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(inStr);
  sdfDestination = new SimpleDateFormat("MMM dd, hh:mm:ss");
  intime = sdfDestination.format(date);
  }
  catch (Exception e)
  {
  e.getMessage();
  }
  }

  if((rs.getString(3)!=null && rs.getString(3)!=""))
  {
  outStr = rs.getString(3).toString().substring(0,rs.getString(2).toString().indexOf("."));
  try
  {
  date = new  SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(outStr);
  sdfDestination = new SimpleDateFormat("MMM dd, hh:mm:ss");
  outtime = sdfDestination.format(date);
  }
  catch (Exception e)
  {
  e.getMessage();
  }
  }
  %>

<br>
  <table align="right">
  <tr style="background-color:<%=strcolor%>;">
   
   <td align="center">Last login at:-<%=intime%></td></tr>
   <tr style="background-color:<%=strcolor%>;">
   <td align="center">logout at:-<%=outtime%></td>
   </tr>
   </table>
    <%
  }
  conn.close();
} 
catch (Exception e)
{
  e.printStackTrace();
}
%> 
   
   
   <%
   
  System.out.println(un);
	System.out.println("MySQL Connect Example.");
	Connection conn1 = null;
	String url1 = "jdbc:mysql://localhost:3306/";
	String dbName1 = "boa";
	String driver1 = "com.mysql.jdbc.Driver";
	String username1 = "root"; 
	String userPassword1 = "root";

	  java.util.Date now = new java.util.Date();
	  String DATE_FORMAT = "yyyy-MM-dd hh:mm:ss";
	  SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
	  
    String strDateNew = sdf.format(now) ;


    try {
      Class.forName(driver1).newInstance();
      conn1 = DriverManager.getConnection(url1+dbName1,username1,userPassword1);
	  Statement st1 = conn1.createStatement();
	  String strQuery = "select panno from register where pass='"+pw+"'"; 
	  //out.println(strQuery);
	  ResultSet rs = st1.executeQuery(strQuery);
	 
	   if(rs.next())
		{
		   
		   
			String user2=rs.getString(1);
      System.out.println(user2);
			session.setAttribute("user2",user2);
		    session.setAttribute("intime",strDateNew);

		    String queryString1 = "update admin set intime='"+strDateNew+"' where pan='"+user2+"'";
			int i = st1.executeUpdate(queryString1);

		}
			conn1.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
 %> 
  
 




</body>
 </html>